package com.zyp.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 其中抽象通知者
 * 
 * @author Administrator
 *
 */
public abstract  class AbstractSubject implements Subject{

	private List<Observer> list=new ArrayList<Observer>();
	
	@Override
	public void add(Observer observer) {
		list.add(observer);
	}

	@Override
	public void remove(Observer observer) {
		list.remove(observer);
	}

	@Override
	public void notifyObservers() {
		for(Observer o:list){
			o.doUpdate();
		}
	}

}
